package feri.pkg;

import android.R.bool;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;


class MyoverlayClass extends com.google.android.maps.Overlay
{
	
	GeoPoint p;
	boolean trenutna= false;
	
	
	public MyoverlayClass(GeoPoint point){
		
		this.p = point;		
		
	}
	
	public MyoverlayClass(GeoPoint point, boolean trenutna){
		
		this.p = point;		
		this.trenutna = trenutna;
	}
	
	
    @Override
    public boolean draw(Canvas canvas, MapView mapView,boolean shadow, long when) 
    {
        super.draw(canvas, mapView, shadow);                   

        //---translate the GeoPoint to screen pixels---
        Point screenPts = new Point();
        mapView.getProjection().toPixels(p, screenPts);

        //---add the marker---
        Bitmap bmp= BitmapFactory.decodeResource(mapView.getResources(), R.drawable.modri); 
        int minus=20;
        int minus2 = 13;
        if(trenutna==true){
        	
        	bmp = BitmapFactory.decodeResource(mapView.getResources(), R.drawable.reddot);
        	minus=10;
        	minus2 = 4;
        }
         
        
        canvas.drawBitmap(bmp, screenPts.x-minus2, screenPts.y-minus, null); //odšteti moramo višino pina      
        
        return true;
    }
} 